package ocumed.teams.teamb.gui;
/* PrintWithJ2SE12.java: Drucken mit J2SE-1.2-Funktionen */

import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;

import ocumed.teams.teamb.application.RezeptErstellen;

public class PrintJob
{
  private PrinterJob prjob;
  private PageFormat pfUse;
  RezeptErstellen m_controller = null;
  Integer m_rezeptId = null;
  RezeptErstellenModel m_tablemodel;
          
  public PrintJob(RezeptErstellenModel tablemodel)
  {
    m_tablemodel = tablemodel;
    prjob = PrinterJob.getPrinterJob();
    pfUse = prjob.defaultPage();
  }

  public boolean setupDialogs()
  {
    PageFormat pfDflt = pfUse;
    pfUse = prjob.pageDialog( pfDflt );
    return ( pfUse == pfDflt ) ? false : prjob.printDialog();
  }

  public void print( int iResMul )
  throws PrinterException
  {
    // See file MyPrintableObject.java:
    PrintableRezept myPrObj = new PrintableRezept(m_tablemodel);
    myPrObj.iResMul = iResMul;
    prjob.setPrintable( myPrObj, pfUse );
    prjob.print();
  }
}